package com.tsk.user;

import com.tsk.base.annotation.EnableResultServer;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * @author: 黄嘉振
 * @create: 2023/1/20 9:47
 * @description:
 **/
@SpringBootApplication
@EnableFeignClients
@EnableDiscoveryClient
@MapperScan("com.tsk.user.mapper")
@EnableResultServer
public class UserApplication {
    public static String prot ;

    public static void main(String[] args) {

        // nacos client 的log back与自定义logbook存在冲突，以下是解决方案：
        // 1、修改自定义的logback.xml的contextName属性与nacsos-client.jar的配置保持一致
        // 2、启动命令添加配置 -Dnacos.logging.default.config.enabled=false，该配置在nacos加载时，读取系统配置
        System.setProperty("nacos.logging.default.config.enabled", "false");
        ConfigurableApplicationContext applicationContext = SpringApplication.run(UserApplication.class, args);
        //获取端口
//        ConfigurableEnvironment environment = applicationContext.getEnvironment();
//        System.out.println(environment.getProperty("server.port"));
//        prot = environment.getProperty("server.port");
    }
}
